/**
 * 应用状态枚举
 */
export enum AppStatus {
  PENDING = 0,   // 待审核
  PUBLISHED = 1, // 已发布
  OFFLINE = 2    // 已下线
}

/**
 * 审核状态枚举
 */
export enum AuditStatus {
  PENDING = 0,   // 待审核
  APPROVED = 1,  // 通过
  REJECTED = 2   // 拒绝
}

/**
 * 分页查询参数
 */
export interface PageQuery {
  pageNum: number;
  pageSize: number;
}

/**
 * 分页结果
 */
export interface PageResult<T> {
  records: T[];
  total: number;
  size: number;
  current: number;
  pages: number;
}

/**
 * 应用查询参数
 */
export interface AppQueryParams extends PageQuery {
  name?: string;
  status?: AppStatus;
  categoryId?: number;
  developerId?: number;
}

/**
 * 分类实体
 */
export interface Category {
  id: number;
  name: string;
  icon: string;
  sortOrder: number;
  createdAt: string;
}

/**
 * 应用实体
 */
export interface App {
  id: number;
  name: string;
  description: string;
  icon: string;
  packageName: string;
  version: string;
  versionCode: number;
  size: number;
  downloads: number;
  status: AppStatus;
  developerId: number;
  developerName: string;
  packagePath: string;
  categories: Category[];
  screenshots: string[];
  createdAt: string;
  updatedAt: string;
}

/**
 * 应用请求参数
 */
export interface AppRequest {
  id?: number;
  name: string;
  description: string;
  packageName: string;
  version: string;
  versionCode: number;
  categoryIds: number[];
}

/**
 * 审核查询参数
 */
export interface AuditQueryParams extends PageQuery {
  appName?: string;
  status?: AuditStatus;
  developerId?: number;
}

/**
 * 审核实体
 */
export interface Audit {
  id: number;
  appId: number;
  appName: string;
  appIcon: string;
  appVersion: string;
  status: AuditStatus;
  comment: string;
  auditorId: number;
  auditorName: string;
  createdAt: string;
  updatedAt: string;
}

/**
 * 审核请求参数
 */
export interface AuditRequest {
  appId: number;
  status: AuditStatus;
  comment?: string;
}

/**
 * 分类请求参数
 */
export interface CategoryRequest {
  id?: number;
  name: string;
  icon?: string;
  sortOrder?: number;
} 